#ifndef CDAL_H
#define CDAL_H

#include <map>
#include <string>

struct sqlite3;
struct sqlite3_stmt;

class CDalRecord;

class CDal
{
  public:
    CDal();
    virtual ~CDal();

    sqlite3* open(const char *db);

    void close(const char *db);

    sqlite3* getConnection(const char *db);

    bool insertSql(const char *db, const char *sql);

    int getLastInsertId(const char *db);

    CDalRecord* selectSql(const char *db, const char *sql);

    std::string escape(const std::string &base, char find);
  protected:
  private:
    static std::map <std::string, sqlite3*> mConnection;
};

#endif // CDAL_H
